package com.company;

import java.io.*;
import java.util.Scanner;

public class _统计功能 {
    public static void main(String[] args) throws IOException {
        //带标签的continue！
        outer:
        while (true) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入您的id：");
            //获取id号，已确认身份，和具体文件！
            String id = scanner.nextLine();
            //具体文件
            File f = new File(id + ".txt");
            if (!f.exists()) {
                System.out.println("您的id号输入有误或不存在！");
                continue outer;  //带标签的continue！
            }

            BufferedReader br = new BufferedReader(new FileReader(f));


            char[] c1 = "水费已缴费".toCharArray();
            char[] c2 = "水费未缴费".toCharArray();
            char[] c3 = "电费已缴费".toCharArray();
            char[] c4 = "电费未缴费".toCharArray();


            //对文件的单行输入！
            String _id = br.readLine();
            String _身份 = br.readLine();
            String _姓名 = br.readLine();
            String _性别 = br.readLine();
            String _班级 = br.readLine();
            String _用电量 = br.readLine();
            String _用水量 = br.readLine();
            double waterFare = Integer.parseInt(_用水量) * 3.10;
            //eleFare 为电费的变量名！
            double eleFare = Integer.parseInt(_用电量) * 0.588;
            System.out.println("您的水费为：" + waterFare + "\n" + "您的电费为：" + eleFare);
            System.out.println("水费未缴费！！！");
            System.out.println("电费未缴费！！！");
            while (true) {
            System.out.println("是否缴水费？");
            String s2 = scanner.nextLine();
            System.out.println("是否缴电费？");
            String s3 = scanner.nextLine();

                if (s2.equals("是") && s3.equals("是")) {
                    System.out.println("水费缴费成功！");
                    System.out.println("电费缴费成功！");

                    //打印文件的内容！
                    System.out.println(_id);
                    System.out.println(_身份);
                    System.out.println(_姓名);
                    System.out.println(_性别);
                    System.out.println(_班级);
                    System.out.println("您的水费为：" + waterFare + "\n" + "您的电费为：" + eleFare);
                    System.out.println("您的水费已缴费！");
                    System.out.println("您的电费已缴费！");
                break;
                } else if (s2.equals("是") && s3.equals("否")) {
                    System.out.println("水费缴费成功！");
                    //打印文件的内容！
                    System.out.println(_id);
                    System.out.println(_身份);
                    System.out.println(_姓名);
                    System.out.println(_性别);
                    System.out.println(_班级);
                    System.out.println("您的水费为：" + waterFare + "\n" + "您的电费为：" + eleFare);
                    System.out.println("您的水费已缴费！");
                    System.out.println("您的电费未缴费！");
                break;
                } else if (s2.equals("否") && s3.equals("否")) {
                    //打印文件的内容！
                    System.out.println(_id);
                    System.out.println(_身份);
                    System.out.println(_姓名);
                    System.out.println(_性别);
                    System.out.println(_班级);
                    System.out.println("您的水费为：" + waterFare + "\n" + "您的电费为：" + eleFare);
                    System.out.println("您的水费未缴费！");
                    System.out.println("您的电费未缴费！");
                break;
                } else if (s2.equals("否") && s3.equals("是")) {
                    System.out.println("电费缴费成功！");
                    //打印文件的内容！
                    System.out.println(_id);
                    System.out.println(_身份);
                    System.out.println(_姓名);
                    System.out.println(_性别);
                    System.out.println(_班级);
                    System.out.println("您的水费为：" + waterFare + "\n" + "您的电费为：" + eleFare);
                    System.out.println("您的水费未缴费！");
                    System.out.println("您的电费已缴费！");
                break;
                } else {
                    System.out.println("您的输入非法或电脑不识别！");
                continue ;
                }


            }


        }
    }

    }
